import time

from selenium import webdriver
#  打开浏览器
from selenium.webdriver.common.by import By
from unittest import TestCase


class TestLogin(TestCase):

    # 正常普通用户登陆-校验登陆成功
    def testLogin1(self):
        username = "lisi"
        password = "123456"
        expect = "个人理财系统"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)
        # 7.判断是否是否登录成
        # 7.1获取浏览器标题数据
        result = driver.title

        if result != expect:
            driver.save_screenshot(expect + "--.jpg")
        else:
            print("登陆用例通过！")


        driver.quit() # 自动关闭浏览器

        self.assertEqual(expect,result)


    # 正常银行端登陆-校验登陆成功
    def testLogin2(self):
        username = "admin"
        password = "123456"
        expect = "后台管理系统"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)
        # 7.判断是否是否登录成
        # 7.1获取浏览器标题数据
        result = driver.title

        if result != expect:
            driver.save_screenshot(expect + "--.jpg")
        else:
            print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect, result)

    # 错误用户名登陆-校验不存在账户登陆
    def testLogin3(self):
        username = "lisi3"
        password = "123456"
        expect = "用户名不存在"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)
        # 7.判断是否是否登录成
        # 7.1获取浏览器标题数据
        result = driver.find_element(By.XPATH,"/html/body/div/div/div/form/div[1]/span[1]").text # Text获取里面的文本数据

        if result != expect:
            driver.save_screenshot(expect + "--.jpg")
        else:
            print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect, result)

    #错误密码登陆-校验密码错误账户登陆
    def testLogin4(self):
        username = "lisi"
        password = "1234567"
        expect = "密码错误"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)
        # 7.判断是否是否登录成
        # 7.1获取浏览器标题数据
        result = driver.find_element(By.XPATH,"/html/body/div/div/div/form/div[2]/span[1]").text # Text获取里面的文本数据

        if result != expect:
            driver.save_screenshot(expect + "--.jpg")
        else:
            print("登陆用例通过！")

        expect1 = "买入成功!"
        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect, result)

    #正常买入零钱理财-支付宝零钱理财
    def testLogin5(self):
        username = "lisi"
        password = "123456"
        password2 = "666666"
        expect1 = "买入成功!"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 点击个人中心
        ele9 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a')
        ele9.click()
        time.sleep(1)
        # 点击银行卡管理
        ele10 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        #获取初始金额
        re1 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        re2 = re1[5:-1]
        re2 = float(re2)


        #8.个人理财按钮
        ele5 = driver.find_element(By.XPATH,'//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/a')
        ele5.click()
        time.sleep(1)
        #9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH,'//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/ul/li[1]/a')
        ele6.click()
        time.sleep(1)
        #10.投资按钮
        ele7 = driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[6]/button')
        ele7.click()
        time.sleep(1)
        #11.输入密码
        ele8 = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/input')
        ele8.send_keys(password2)
        time.sleep(1)
        #12.确定按钮
        ele9 = driver.find_element(By.XPATH,'/html/body/div[3]/div[3]/a[1]')
        ele9.click()
        time.sleep(1)

        result1 = driver.find_element(By.XPATH,"/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div").text

        ele10 = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button')
        ele10.click()
        time.sleep(1)

        ele10 = driver.find_element(By.XPATH,'/html/body/div[1]/div/aside/div[2]/nav/ul/li[4]/a')
        ele10.click()
        time.sleep(1)

        ele10 = driver.find_element(By.XPATH,'/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        # 7.判断是否是否登录成
        # 7.1获取浏览器标题数据

        result2 = driver.find_element(By.XPATH,"/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]").text # Text获取里面的文本数据
        re3 = result2[5:-1]
        re3 = float(re3)
        expect2 = re2 - 100
        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            if re3 == expect2:
                print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)
        self.assertEqual(expect2, re3)

    #错误支付密码-买零钱理财-支付宝零钱理财
    def testLogin6(self):
        username = "lisi"
        password = "123456"
        password2 = "666667"
        expect1 = "买入失败!"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 点击个人中心
        ele9 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a')
        ele9.click()
        time.sleep(1)
        # 点击银行卡管理
        ele10 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        #获取初始金额
        re1 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        re2 = re1[5:-1]
        re2 = float(re2)

        #8.个人理财按钮
        ele5 = driver.find_element(By.XPATH,'//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/a')
        ele5.click()
        time.sleep(1)
        #9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH,'//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/ul/li[1]/a')
        ele6.click()
        time.sleep(1)
        #10.投资按钮
        ele7 = driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[6]/button')
        ele7.click()
        time.sleep(1)
        #11.输入密码
        ele8 = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/input')
        ele8.send_keys(password2)
        time.sleep(1)
        #12.确定按钮
        ele9 = driver.find_element(By.XPATH,'/html/body/div[3]/div[3]/a[1]')
        ele9.click()
        time.sleep(1)

        result1 = driver.find_element(By.XPATH,"/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div").text

        ele10 = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button')
        ele10.click()
        time.sleep(1)

        ele10 = driver.find_element(By.XPATH,'/html/body/div[1]/div/aside/div[2]/nav/ul/li[4]/a')
        ele10.click()
        time.sleep(1)

        ele10 = driver.find_element(By.XPATH,'/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        # 7.判断是否是否登录成
        # 7.1获取浏览器标题数据

        result2 = driver.find_element(By.XPATH,"/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]").text # Text获取里面的文本数据
        re3 = result2[5:-1]
        re3 = float(re3)
        expect2 = re2
        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            if re3 == expect2:
                print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)
        self.assertEqual(expect2, re3)

    #余额不足买入理财产品-支付宝零钱理财
    def testLogin7(self):
        username = "zhangsan"
        password = "123456"
        password2 = "666666"
        expect1 = "买入失败!"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 点击个人中心
        ele9 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a')
        ele9.click()
        time.sleep(1)
        # 点击银行卡管理
        ele10 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        # 获取初始金额
        re1 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        re2 = re1[5:-1]
        re2 = float(re2)

        #8.个人理财按钮
        ele5 = driver.find_element(By.XPATH,'//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/a')
        ele5.click()
        time.sleep(1)
        #9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH,'//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/ul/li[1]/a')
        ele6.click()
        time.sleep(1)
        #10.投资按钮
        ele7 = driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[6]/button')
        ele7.click()
        time.sleep(1)
        #11.输入密码
        ele8 = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/input')
        ele8.send_keys(password2)
        time.sleep(1)
        #12.确定按钮
        ele9 = driver.find_element(By.XPATH,'/html/body/div[3]/div[3]/a[1]')
        ele9.click()
        time.sleep(1)

        result1 = driver.find_element(By.XPATH,"/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div").text

        ele10 = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button')
        ele10.click()
        time.sleep(1)

        ele10 = driver.find_element(By.XPATH,'/html/body/div[1]/div/aside/div[2]/nav/ul/li[4]/a')
        ele10.click()
        time.sleep(1)

        ele10 = driver.find_element(By.XPATH,'/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        # 7.判断是否是否登录成
        # 7.1获取浏览器标题数据

        result2 = driver.find_element(By.XPATH,"/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]").text # Text获取里面的文本数据
        re3 = result2[5:-1]
        re3 = float(re3)
        expect2 = re2
        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            if re3 == expect2:
                print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)
        self.assertEqual(expect2, re3)


    #未绑定银行卡-买入零钱理财-支付宝零钱理财
    def testLogin8(self):
        username = "kb"
        password = "123456"
        password2 = "666666"
        expect1 = "买入失败!，请绑定银行卡"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        #8.个人理财按钮
        ele5 = driver.find_element(By.XPATH,'//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/a')
        ele5.click()
        time.sleep(1)
        #9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH,'//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/ul/li[1]/a')
        ele6.click()
        time.sleep(1)
        #10.投资按钮
        ele7 = driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[6]/button')
        ele7.click()
        time.sleep(1)
        #11.输入密码
        ele8 = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/input')
        ele8.send_keys(password2)
        time.sleep(1)
        #12.确定按钮
        ele9 = driver.find_element(By.XPATH,'/html/body/div[3]/div[3]/a[1]')
        ele9.click()
        time.sleep(1)

        result1 = driver.find_element(By.XPATH,"/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div").text
        # 7.判断是否是否登录成
        # 7.1获取浏览器标题数据
        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)


    #正常买入期限理财-支付宝期限理财
    def testLogin9(self):
        username = "lisi"
        password = "123456"
        password2 = "666666"
        expect1 = "买入成功!"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 点击个人中心
        ele9 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a')
        ele9.click()
        time.sleep(1)
        # 点击银行卡管理
        ele10 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        # 获取初始金额
        re1 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        re2 = re1[5:-1]
        re2 = float(re2)

        #8.个人理财按钮
        ele5 = driver.find_element(By.XPATH,'//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/a')
        ele5.click()
        time.sleep(1)
        #9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH,'/html/body/div/div/aside/div[2]/nav/ul/li[2]/ul/li[2]/a')
        ele6.click()
        time.sleep(1)
        #10.投资按钮
        ele7 = driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[8]/button')
        ele7.click()
        time.sleep(1)
        #11.输入密码
        ele8 = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/input')
        ele8.send_keys(password2)
        time.sleep(1)
        #12.确定按钮
        ele9 = driver.find_element(By.XPATH,'/html/body/div[3]/div[3]/a[1]')
        ele9.click()
        time.sleep(1)

        result1 = driver.find_element(By.XPATH,"/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div").text
        #13.购买后的确认按钮
        ele10 = driver.find_element(By.XPATH,'/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button')
        ele10.click()
        time.sleep(1)
        #14.个人中心按钮
        ele10 = driver.find_element(By.XPATH,'/html/body/div[1]/div/aside/div[2]/nav/ul/li[4]/a')
        ele10.click()
        time.sleep(1)
        #15.银行卡管理按钮
        ele10 = driver.find_element(By.XPATH,'/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        # 判断是否是否登录成
        # 获取浏览器标题数据

        result2 = driver.find_element(By.XPATH,"/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]").text # Text获取里面的文本数据
        re3 = result2[5:-1]
        re3 = float(re3)
        expect2 = re2 - 5000
        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            if re3 == expect2:
                print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)
        self.assertEqual(expect2, re3)


    #错误支付密码-买期限理财-支付宝期限理财
    def testLogin10(self):
        username = "lisi"
        password = "123456"
        password2 = "666667"
        expect1 = "买入失败!"
        expect2 = "账户余额：1000000.00元"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 点击个人中心
        ele9 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a')
        ele9.click()
        time.sleep(1)
        # 点击银行卡管理
        ele10 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        # 获取初始金额
        re1 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        re2 = re1[5:-1]
        re2 = float(re2)

        # 8.个人理财按钮
        ele5 = driver.find_element(By.XPATH, '//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/a')
        ele5.click()
        time.sleep(1)
        # 9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH,'/html/body/div/div/aside/div[2]/nav/ul/li[2]/ul/li[2]/a')
        ele6.click()
        time.sleep(1)
        # 10.投资按钮
        ele7 = driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[8]/button')
        ele7.click()
        time.sleep(1)
        # 11.输入密码
        ele8 = driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/input')
        ele8.send_keys(password2)
        time.sleep(1)
        # 12.确定按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div[3]/div[3]/a[1]')
        ele9.click()
        time.sleep(1)

        result1 = driver.find_element(By.XPATH,"/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div").text

        ele10 = driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button')
        ele10.click()
        time.sleep(1)

        ele10 = driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[4]/a')
        ele10.click()
        time.sleep(1)

        ele10 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        # 7.判断是否是否登录成
        # 7.1获取浏览器标题数据

        result2 = driver.find_element(By.XPATH,"/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]").text  # Text获取里面的文本数据
        re3 = result2[5:-1]
        re3 = float(re3)
        expect2 = re2
        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            if re3 == expect2:
                print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)
        self.assertEqual(expect2, re3)


    #余额不足买入期限理财-支付宝期限理财
    def testLogin11(self):
        username = "zhangsan"
        password = "123456"
        password2 = "666666"
        expect1 = "买入失败!"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 点击个人中心
        ele9 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a')
        ele9.click()
        time.sleep(1)
        # 点击银行卡管理
        ele10 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        # 获取初始金额
        re1 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        re2 = re1[5:-1]
        re2 = float(re2)

        # 8.个人理财按钮
        ele5 = driver.find_element(By.XPATH, '//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/a')
        ele5.click()
        time.sleep(1)
        # 9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH,'/html/body/div/div/aside/div[2]/nav/ul/li[2]/ul/li[2]/a')
        ele6.click()
        time.sleep(1)
        # 10.投资按钮
        ele7 = driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[8]/button')
        ele7.click()
        time.sleep(1)
        # 11.输入密码
        ele8 = driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/input')
        ele8.send_keys(password2)
        time.sleep(1)
        # 12.确定按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div[3]/div[3]/a[1]')
        ele9.click()
        time.sleep(1)

        result1 = driver.find_element(By.XPATH,"/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div").text

        ele10 = driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button')
        ele10.click()
        time.sleep(1)

        ele10 = driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[4]/a')
        ele10.click()
        time.sleep(1)

        ele10 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        # 7.判断是否是否登录成
        # 7.1获取浏览器标题数据

        result2 = driver.find_element(By.XPATH,"/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]").text  # Text获取里面的文本数据
        re3 = result2[5:-1]
        re3 = float(re3)
        expect2 = re2
        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            if re3 == expect2:
                print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)
        self.assertEqual(expect2, re3)


    #未绑定银行卡-买入期限理财-支付宝期限理财
    def testLogin12(self):
        username = "kb"
        password = "123456"
        password2 = "666666"
        expect1 = "买入失败!，请绑定银行卡"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 8.个人理财按钮
        ele5 = driver.find_element(By.XPATH, '//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/a')
        ele5.click()
        time.sleep(1)
        # 9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH,'/html/body/div/div/aside/div[2]/nav/ul/li[2]/ul/li[2]/a')
        ele6.click()
        time.sleep(1)
        # 10.投资按钮
        ele7 = driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[8]/button')
        ele7.click()
        time.sleep(1)
        # 11.输入密码
        ele8 = driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/input')
        ele8.send_keys(password2)
        time.sleep(1)
        # 12.确定按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div[3]/div[3]/a[1]')
        ele9.click()
        time.sleep(1)

        result1 = driver.find_element(By.XPATH,"/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div").text

        # 7.判断是否是否登录成
        # 7.1获取浏览器标题数据

        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)


    #正常买入基金理财-广发多元新兴股票
    def testLogin13(self):
        username = "lisi"
        password = "123456"
        password2 = "666666"
        expect1 = "买入成功!"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 点击个人中心
        ele9 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a')
        ele9.click()
        time.sleep(1)
        # 点击银行卡管理
        ele10 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        # 获取初始金额
        re1 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        re2 = re1[5:-1]
        re2 = float(re2)

        # 8.个人理财按钮
        ele5 = driver.find_element(By.XPATH, '//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/a')
        ele5.click()
        time.sleep(1)
        # 9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[2]/ul/li[3]/a')
        ele6.click()
        time.sleep(1)
        # 10.投资按钮
        ele7 = driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[9]/button')
        ele7.click()
        time.sleep(1)
        # 11.输入密码
        ele8 = driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/input')
        ele8.send_keys(password2)
        time.sleep(1)
        # 12.确定按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div[3]/div[3]/a[1]')
        ele9.click()
        time.sleep(1)

        result1 = driver.find_element(By.XPATH,"/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div").text
        # 13.购买后的确认按钮
        ele10 = driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button')
        ele10.click()
        time.sleep(1)
        # 14.个人中心按钮
        ele10 = driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[4]/a')
        ele10.click()
        time.sleep(1)
        # 15.银行卡管理按钮
        ele10 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        # 判断是否是否登录成
        # 获取浏览器标题数据

        result2 = driver.find_element(By.XPATH,
                                      "/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]").text  # Text获取里面的文本数据
        re3 = result2[5:-1]
        re3 = float(re3)
        expect2 = re2-3000
        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            if re3 == expect2:
                print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)
        self.assertEqual(expect2, re3)


    #错误支付密码-买基金理财-广发多元新兴股票
    def testLogin14(self):
        username = "lisi"
        password = "123456"
        password2 = "666667"
        expect1 = "买入失败!"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 点击个人中心
        ele9 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a')
        ele9.click()
        time.sleep(1)
        # 点击银行卡管理
        ele10 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        # 获取初始金额
        re1 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        re2 = re1[5:-1]
        re2 = float(re2)

        # 8.个人理财按钮
        ele5 = driver.find_element(By.XPATH, '//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/a')
        ele5.click()
        time.sleep(1)
        # 9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[2]/ul/li[3]/a')
        ele6.click()
        time.sleep(1)
        # 10.投资按钮
        ele7 = driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[9]/button')
        ele7.click()
        time.sleep(1)
        # 11.输入密码
        ele8 = driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/input')
        ele8.send_keys(password2)
        time.sleep(1)
        # 12.确定按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div[3]/div[3]/a[1]')
        ele9.click()
        time.sleep(1)

        result1 = driver.find_element(By.XPATH,"/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div").text
        # 13.购买后的确认按钮
        ele10 = driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button')
        ele10.click()
        time.sleep(1)
        # 14.个人中心按钮
        ele10 = driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[4]/a')
        ele10.click()
        time.sleep(1)
        # 15.银行卡管理按钮
        ele10 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        # 判断是否是否登录成
        # 获取浏览器标题数据

        result2 = driver.find_element(By.XPATH,
                                      "/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]").text  # Text获取里面的文本数据
        re3 = result2[5:-1]
        re3 = float(re3)
        expect2 = re2
        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            if re3 == expect2:
                print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)
        self.assertEqual(expect2, re3)


    #余额不足买入基金理财-广发多元新兴股票
    def testLogin15(self):
        username = "zhangsan"
        password = "123456"
        password2 = "666666"
        expect1 = "买入失败!"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 点击个人中心
        ele9 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a')
        ele9.click()
        time.sleep(1)
        # 点击银行卡管理
        ele10 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        # 获取初始金额
        re1 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        re2 = re1[5:-1]
        re2 = float(re2)

        # 8.个人理财按钮
        ele5 = driver.find_element(By.XPATH, '//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/a')
        ele5.click()
        time.sleep(1)
        # 9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[2]/ul/li[3]/a')
        ele6.click()
        time.sleep(1)
        # 10.投资按钮
        ele7 = driver.find_element(By.XPATH,
                                   '/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[9]/button')
        ele7.click()
        time.sleep(1)
        # 11.输入密码
        ele8 = driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/input')
        ele8.send_keys(password2)
        time.sleep(1)
        # 12.确定按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div[3]/div[3]/a[1]')
        ele9.click()
        time.sleep(1)

        result1 = driver.find_element(By.XPATH,
                                      "/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div").text
        # 13.购买后的确认按钮
        ele10 = driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[4]/button')
        ele10.click()
        time.sleep(1)
        # 14.个人中心按钮
        ele10 = driver.find_element(By.XPATH, '/html/body/div[1]/div/aside/div[2]/nav/ul/li[4]/a')
        ele10.click()
        time.sleep(1)
        # 15.银行卡管理按钮
        ele10 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        # 判断是否是否登录成
        # 获取浏览器标题数据

        result2 = driver.find_element(By.XPATH,
                                      "/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]").text  # Text获取里面的文本数据
        re3 = result2[5:-1]
        re3 = float(re3)
        expect2 = re2
        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            if re3 == expect2:
                print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)
        self.assertEqual(expect2, re3)


    #未绑定银行卡-买入基金理财-广发多元新兴股票
    def testLogin16(self):
        username = "kb"
        password = "123456"
        password2 = "666666"
        expect1 = "买入失败!，请绑定银行卡"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 8.个人理财按钮
        ele5 = driver.find_element(By.XPATH, '//*[@id="leftbaraside"]/div[2]/nav/ul/li[2]/a')
        ele5.click()
        time.sleep(1)
        # 9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[2]/ul/li[3]/a')
        ele6.click()
        time.sleep(1)
        # 10.投资按钮
        ele7 = driver.find_element(By.XPATH,
                                   '/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[9]/button')
        ele7.click()
        time.sleep(1)
        # 11.输入密码
        ele8 = driver.find_element(By.XPATH, '/html/body/div[3]/div[2]/input')
        ele8.send_keys(password2)
        time.sleep(1)
        # 12.确定按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div[3]/div[3]/a[1]')
        ele9.click()
        time.sleep(1)

        result1 = driver.find_element(By.XPATH,"/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div[3]/div/div").text
        # 判断是否是否登录成
        # 获取浏览器标题数据

        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)


    #正常申请贷款测试
    def testLogin17(self):
        username = "lisi"
        password = "123456"
        money = "10000"
        day = "10"
        expect1 = "申请成功!请等待管理员审核"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 8.个人理财按钮
        ele5 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[3]/a')
        ele5.click()
        time.sleep(1)
        # 9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[3]/ul/li[2]/a')
        ele6.click()
        time.sleep(1)
        # 10.借款金额
        ele7 = driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[1]/input')
        ele7.send_keys(money)
        time.sleep(1)
        # 11.借款期限
        ele8 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[3]/input')
        ele8.send_keys(day)
        time.sleep(1)
        # 12.申请按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[4]/button')
        ele9.click()
        time.sleep(1)
        #13.确认按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div[2]/div[2]/div/div/div/div/div/div/div/div[4]/button[1]')
        ele9.click()
        time.sleep(0.5)

        result1 = driver.find_element(By.XPATH,"/html/body/div[2]/div[2]/div/div/div/div/div/div/div/div[3]/div/div").text
        # 判断是否是否登录成
        # 获取浏览器标题数据

        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)


    #正常申请贷款-银行审批通过测试
    def testLogin18(self):
        username = "lisi"
        password = "123456"
        money = "10000"
        day = "10"
        expect1 = "通过审核修改成功！"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 点击个人中心
        ele9 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a')
        ele9.click()
        time.sleep(1)
        # 点击银行卡管理
        ele10 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele10.click()
        time.sleep(1)
        # 获取初始金额
        re1 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
        re2 = re1[5:-1]
        re2 = float(re2)

        # 8.个人理财按钮
        ele5 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[3]/a')
        ele5.click()
        time.sleep(1)
        # 9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[3]/ul/li[2]/a')
        ele6.click()
        time.sleep(1)
        # 10.借款金额
        ele7 = driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[1]/input')
        ele7.send_keys(money)
        time.sleep(1)
        # 11.借款期限
        ele8 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[3]/input')
        ele8.send_keys(day)
        time.sleep(1)
        # 12.申请按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[4]/button')
        ele9.click()
        time.sleep(1)
        #13.确认按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div[2]/div[2]/div/div/div/div/div/div/div/div[4]/button[1]')
        ele9.click()
        time.sleep(0.5)

        driver.quit()
        # 判断是否是否登录成
        # 获取浏览器标题数据

        username1 = "admin"
        password1 = "123456"
        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username1)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password1)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)
        #网贷管理按钮
        ele4 = driver.find_element(By.XPATH,'/html/body/div/div/aside/div[2]/nav/ul/li[5]/a').click()
        time.sleep(1)
        #网贷审核按钮
        ele5 = driver.find_element(By.XPATH,'/html/body/div/div/aside/div[2]/nav/ul/li[5]/ul/li[1]/a').click()
        time.sleep(1)
        #审核通过按钮
        ele6 = driver.find_element(By.XPATH,'/html/body/div/div/main/div/div/div/div/div[2]/div/table/tbody/tr[1]/td[7]/button[1]').click()
        time.sleep(1)
        #确认按钮
        ele7 = driver.find_element(By.XPATH,'/html/body/div[2]/div[2]/div/div/div/div/div/div/div/div[4]/button[1]').click()
        time.sleep(0.5)

        result1 = driver.find_element(By.XPATH,'/html/body/div[2]/div[2]/div/div/div/div/div/div/div/div[3]/div/div').text


        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        ele3 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a')
        ele3.click()
        time.sleep(1)

        ele3 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a')
        ele3.click()
        time.sleep(1)
        result2 = driver.find_element(By.XPATH,"/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]").text
        re3 = result2[5:-1]
        re3 = float(re3)
        expect2 = re2+10000
        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            if re3 == expect2:
                print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1,result1)
        self.assertEqual(expect2, re3)


    #未绑定银行卡-申请贷款
    def testLogin19(self):
        username = "kb"
        password = "123456"
        money = "10000"
        day = "10"
        expect1 = "申请失败!,请先绑定银行卡"


        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 8.个人理财按钮
        ele5 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[3]/a')
        ele5.click()
        time.sleep(1)
        # 9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[3]/ul/li[2]/a')
        ele6.click()
        time.sleep(1)
        # 10.借款金额
        ele7 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[1]/input')
        ele7.send_keys(money)
        time.sleep(1)
        # 11.借款期限
        ele8 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[3]/input')
        ele8.send_keys(day)
        time.sleep(1)
        # 12.申请按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[4]/button')
        ele9.click()
        time.sleep(1)
        # 13.确认按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div[2]/div[2]/div/div/div/div/div/div/div/div[4]/button[1]')
        ele9.click()
        time.sleep(0.5)

        result1 = driver.find_element(By.XPATH,
                                      "/html/body/div[2]/div[2]/div/div/div/div/div/div/div/div[3]/div/div").text
        # 判断是否是否登录成
        # 获取浏览器标题数据

        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)


    #申请超大额贷款测试
    def testLogin20(self):
        username = "lisi"
        password = "123456"
        money = "100000000000000000"
        day = "10"
        expect1 = "申请失败"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 8.个人理财按钮
        ele5 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[3]/a')
        ele5.click()
        time.sleep(1)
        # 9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[3]/ul/li[2]/a')
        ele6.click()
        time.sleep(1)
        # 10.借款金额
        ele7 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[1]/input')
        ele7.send_keys(money)
        time.sleep(1)
        # 11.借款期限
        ele8 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[3]/input')
        ele8.send_keys(day)
        time.sleep(1)
        # 12.申请按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[4]/button')
        ele9.click()
        time.sleep(1)
        # 13.确认按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div[2]/div[2]/div/div/div/div/div/div/div/div[4]/button[1]')
        ele9.click()
        time.sleep(0.3)

        result1 = driver.find_element(By.XPATH,
                                      "/html/body/div[2]/div[2]/div/div/div/div/div/div/div/div[3]/div/div").text
        # 判断是否是否登录成
        # 获取浏览器标题数据

        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)

    #<100小额拒绝贷款测试    错误案例！
    def testLogin21(self):
        username = "lisi"
        password = "123456"
        money = "50"
        day = "10"
        expect1 = "申请失败，申请额度必须是100的整数倍"


        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 8.个人理财按钮
        ele5 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[3]/a')
        ele5.click()
        time.sleep(1)
        # 9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[3]/ul/li[2]/a')
        ele6.click()
        time.sleep(1)
        # 10.借款金额
        ele7 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[1]/input')
        ele7.send_keys(money)
        time.sleep(1)
        # 11.借款期限
        ele8 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[3]/input')
        ele8.send_keys(day)
        time.sleep(1)
        # 12.申请按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[4]/button')
        ele9.click()
        time.sleep(1)
        # 13.确认按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div[2]/div[2]/div/div/div/div/div/div/div/div[4]/button[1]')
        ele9.click()
        time.sleep(0.5)

        result1 = driver.find_element(By.XPATH,"/html/body/div[2]/div[2]/div/div/div/div/div/div/div/div[3]/div/div").text
        # 判断是否是否登录成
        # 获取浏览器标题数据

        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)    #


    #贷款额度-期限超期测试
    def testLogin22(self):
        username = "lisi"
        password = "123456"
        money = "10"
        day = "10000"
        expect1 = "输入期限不合法！"


        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 8.个人理财按钮
        ele5 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[3]/a')
        ele5.click()
        time.sleep(1)
        # 9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[3]/ul/li[2]/a')
        ele6.click()
        time.sleep(1)
        # 10.借款金额
        ele7 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[1]/input')
        ele7.send_keys(money)
        time.sleep(1)
        # 11.借款期限
        ele8 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[3]/input')
        ele8.send_keys(day)
        time.sleep(1)
        # 12.申请按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[4]/button')
        ele9.click()
        time.sleep(1)

        result1 = driver.find_element(By.XPATH,
                                      "/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[3]/span").text
        # 判断是否是否登录成
        # 获取浏览器标题数据

        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)    #


    #贷款额度-期限超期测试
    def testLogin22(self):
        username = "lisi"
        password = "123456"
        money = "10"
        day = "9999"
        expect1 = "申请成功!请等待管理员审核"

        driver = webdriver.Chrome()

        # 2.最大化窗口:防止无法定位
        driver.maximize_window()

        # 3.访问系统
        driver.get("http://localhost:90/")

        # 4.输入用户名
        ele1 = driver.find_element(By.ID, "username")
        ele1.send_keys(username)
        time.sleep(1)
        # 5.输入密码
        ele2 = driver.find_element(By.ID, 'password')
        ele2.send_keys(password)
        time.sleep(1)
        # 6.点击登陆
        ele3 = driver.find_element(By.ID, 'login_btn')
        ele3.click()
        time.sleep(1)

        # 8.个人理财按钮
        ele5 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[3]/a')
        ele5.click()
        time.sleep(1)
        # 9.零钱理财按钮
        ele6 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[3]/ul/li[2]/a')
        ele6.click()
        time.sleep(1)
        # 10.借款金额
        ele7 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[1]/input')
        ele7.send_keys(money)
        time.sleep(1)
        # 11.借款期限
        ele8 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[3]/input')
        ele8.send_keys(day)
        time.sleep(1)
        # 12.申请按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div/div/div[2]/div/form/div[4]/button')
        ele9.click()
        time.sleep(1)

        # 13.确认按钮
        ele9 = driver.find_element(By.XPATH, '/html/body/div[2]/div[2]/div/div/div/div/div/div/div/div[4]/button[1]')
        ele9.click()
        time.sleep(0.5)

        result1 = driver.find_element(By.XPATH,
                                      "/html/body/div[2]/div[2]/div/div/div/div/div/div/div/div[3]/div/div").text
        # 判断是否是否登录成
        # 获取浏览器标题数据

        if result1 != expect1:
            driver.save_screenshot(expect1 + "--.jpg")
        else:
            print("登陆用例通过！")

        driver.quit()  # 自动关闭浏览器

        self.assertEqual(expect1, result1)  #


